package org.ysu.service.impl;

import org.springframework.stereotype.Service;
import org.ysu.service.CodeService;

import javax.annotation.Resource;
import java.util.Random;

@Service
public class CodeServiceImpl implements CodeService {
    @Override
    public String generateCode(Integer num) {
        Random random = new Random();
        StringBuilder sb = new StringBuilder();
        for (int i=0;i<num;i++){
            int digit = random.nextInt(9) + 1;
            sb.append(digit);
        }
        return sb.toString();
    }
}
